package com.sdleyou.treepro.common.rabbitmq.consumer;

import com.sdleyou.treepro.common.rabbitmq.event.StepChangeEvent;
import com.sdleyou.treepro.common.rabbitmq.message.StepChangeMsg;
import com.sdleyou.treepro.common.service.UserAchievementManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 步数变化消费者
 */
@Component
public class StepChangeConsumer implements StepChangeEvent {

    @Autowired
    private UserAchievementManager userAchievementManager;

    /**
     * 更新步数
     * @param stepChangeMsg
     */
    @Override
    public void stepChange(StepChangeMsg stepChangeMsg) {
        userAchievementManager.updateTotalStep(stepChangeMsg.getStep());
    }
}
